package com.fang.controller;

import com.fang.config.AccessLimit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Fang Ruichuan
 * @date 2023-01-07 22:02
 */
@Slf4j
@RestController
@RequestMapping("access")
public class AccessLimiterController {

    @GetMapping("test")
    @AccessLimit(maxCount = 3, second = 60)
    public String limit(HttpServletRequest request) {
        log.error("Access Limit Test");
        return "限流测试";
    }
}
